{% extends "base.html" %}
{% block header %}添加新卡{% endblock %}
{% block content %}
<div class="container">
    <h2>添加新卡</h2>
    <form method="post">
        {% csrf_token %}
        <div class="row">
            <div class="">
                <label>ICCID</label>
                <input type="text" name="iccid" class="form-control">
            </div>
            <div class="">
                <label>MSISDN</label>
                <input type="text" name="msisdn" class="form-control">
            </div>
            <div class="">
                <label>分配用户（可选）</label>
                <select name="user_id" class="form-control">
                    <option value="">不分配</option>
                    {% for user in users %}
                    <option value="{{ user.id }}">{{ user.username }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>
        <p class="text-muted mt-2">ICCID 和 MSISDN 至少填写一个</p>
        {% if error %}<div class="alert alert-danger">{{ error }}</div>{% endif %}
        <button type="submit" class="btn btn-success">保存</button>
        <a href="/cards/" class="btn btn-secondary ms-2">取消</a>
    </form>
</div>
{% endblock %}